<!DOCTYPE html>
<html>
<head>
	<title>代码生成器</title>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<link rel="stylesheet" href="css/font-awesome.min.css">
	<link rel="stylesheet" href="plugins/jqgrid/ui.jqgrid-bootstrap.css">
	<link rel="stylesheet" href="css/main.css">
	<script src="libs/jquery.min.js"></script>
	<script src="plugins/layer/layer.js"></script>
	<script src="libs/bootstrap.min.js"></script>
	<script src="libs/vue.min.js"></script>
	<script src="plugins/jqgrid/grid.locale-cn.js"></script>
	<script src="plugins/jqgrid/jquery.jqGrid.min.js"></script>
	<script src="js/common.js"></script>
</head>
<body>
<div id="rrapp">
	<div v-show="showBtn">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.tableName" @keyup.enter="query" placeholder="表名">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<a class="btn btn-primary" @click="add"><i class="fa fa-asterisk"></i>建表DDL</a>
			<a class="btn btn-primary" @click="create"><i class="fa fa-file-code-o"></i>&nbsp;生成代码</a>
		</div>
	</div>
	<div v-show="showList">
		<div v-show="showCreateTitle">
			<div class="panel-heading"><font color="red">代码生成：第一步--》请选择生成的表。</font><font color="blue">全局类名可不填,若填则必须符合JAVA类名定义规范,选中多表时不允许重复!!!</font></div>
		</div>
		<table id="jqGrid"></table>
		<div id="jqGridPager"></div>
	</div>

	<div v-show="showDDL" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal">
			<div class="form-group">
				<div class="col-sm-2 control-label"><font color="#a52a2a">注意事项:</font></div>
				<div class="col-sm-10">
					<textarea cols="1000" rows="3" placeholder="1.工具支持pgsql脚本,建表sql执行前,建议采用notepad++全局替换脚本中所有schema 2.创建表必须规范,主键必须要添加,字段和表的备注必须添加,会用来生成swagger文档" class="form-control"  style="width: 1500px; height: 30px;" readonly></textarea>
				</div>
				<div class="col-sm-2 control-label">SQL脚本</div>
				<div class="col-sm-10">
					<textarea cols="1000" rows="30" placeholder="数据库SQL脚本!(存在删除表风险，谨慎使用),例如:[CREATE TABLE mall.mall_file ],全部的语句中必须把[mall.]全部清除，否则容易出现建表失败！！！ " class="form-control" v-model="config.table" style="width: 1500px; height: 500px;"></textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label"></div>
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="执行脚本"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>

	<div v-show="showCreate" class="panel panel">
		<div class="panel-heading"><font color="red">代码生成：第二步-->配置项目的参数[</font><font color='blue'>英文</font>],<font color="red">请务必填写作者邮箱!!!</font></div>
		<div class="row" style="padding-top:0px;">
			<div class="col-sm-3" style="padding-top:15px;">
				<font color="blue">特殊说明(Mysql+mybatisPlus):</font><ul>
				<li><font color="blue">服务拆分后,代码controller和service归为</font><font color="#ff1493">控制层服务</font></li>
				<li><font color="blue">服务拆分后,代码dao,mapper,entity归为</font><font color="green">持久层服务</font></li>
				<li><font color="blue">是否模糊查询,生成的SQL针对字符串是否为模糊查询</font></li>
				<li><font color="blue">开发者必须填写自己的<font color="#ff1493">姓名和邮箱</font>,方便进行代码追溯</font></li>
				<li><font color="blue">项目配置原则上最好采用<font color="#ff1493">英文</font>,中文会出现兼容性问题</font></li>
			</ul>
			</div>
			<div class="col-sm-9">
				<form class="form-horizontal">
					<div class="form-group">
						<!--<div class="col-sm-2 control-label">根目录</div>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" v-model="config.mainPath" placeholder="根目录" value="com"/>
                        </div>-->
						<div class="container">
							<div class="col-sm-6">
								<div class="col-sm-2 control-label">代码主包路径</div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.packageName" placeholder="根目录" value="com.rainbow.mall"/>
								</div>
								<div class="col-sm-2 control-label"><i class="fa fa-shield fa-rotate-90"></i>&nbsp;<font color="#ff1493">控制层服务名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.moduleName" placeholder="控制层服务名称" value="user"/>
								</div>
								<div class="col-sm-2 control-label"><i class="fa fa-shield fa-rotate-270"></i>&nbsp;<font color="green">持久层服务名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.bottomName" placeholder="持久层服务名称" value="user"/>
								</div>
								<div class="col-sm-2 control-label">是否模糊查询</div>
								<div class="col-sm-10">
									<label class="radio-inline">
										<input type="radio" v-model="config.dynamicLikeEnable" placeholder="动态SQL字符串类型，是否生成like模糊搜索" value="true"/>是
									</label>
									<label class="radio-inline">
										<input type="radio"  v-model="config.dynamicLikeEnable" placeholder="动态SQL字符串类型，是否生成like模糊搜索" value="false" checked="true"/>否
									</label>
								</div>
								<div class="col-sm-2 control-label">feign契约类型</div>
								<div class="col-sm-10">
									<label class="radio-inline">
										<input type="radio" v-model="config.enableFeignDefault" placeholder="采用feign的默认SpringMVC契约模式" value="true" checked="true"/>SpringMVC模式
									</label>
									<label class="radio-inline">
										<input type="radio"  v-model="config.enableFeignDefault" placeholder="采用feign的自定义契约模式" value="false"/>自定义模式
									</label>
								</div>
								<div class="col-sm-2 control-label"><font color="red">*<i class="fa fa-child"></i></font>&nbsp;<font color="#0000CD">作者姓名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.author" placeholder="作者姓名" value="rainbow"/>
								</div>
								<div class="form-group" style="padding-top:150px;">
									<div class="col-sm-2 control-label"></div>
									<input type="button" class="btn btn-primary" @click="generator" value="确定生成"/>
									&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
								</div>
							</div>
							<div class="col-sm-6">
								<div class="col-sm-2 control-label"><i class="fa fa-shield fa-rotate-90"></i>&nbsp;<font color="#ff1493">控制层的包名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.controllerName" placeholder="控制层包名" value="controller"/>
								</div>
								<div class="col-sm-2 control-label"><i class="fa fa-shield fa-rotate-90"></i>&nbsp;<font color="#ff1493">业务层的包名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.serviceName" placeholder="业务层包名" value="service" />
								</div>
								<div class="col-sm-2 control-label"><i class="fa fa-shield fa-rotate-270"></i>&nbsp;<font color="green">持久层的包名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.daoName" placeholder="持久层的包名" value="mapper" />
								</div>
								<div class="col-sm-2 control-label"><i class="fa fa-shield fa-rotate-270"></i>&nbsp;<font color="green">实体类的包名</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.entityName" placeholder="实体类的包名" value="entity"/>
								</div>
								<div class="col-sm-2 control-label">服务降级处理</div>
								<div class="col-sm-10">
									<label class="radio-inline">
										<input type="radio" v-model="config.enableFallBackDefault" placeholder="采用sentinel的模式降级处理" value="true" checked="true"/>sentinel
									</label>
									<label class="radio-inline">
										<input type="radio"  v-model="config.enableFallBackDefault" placeholder="采用hystrix的模式降级处理" value="false" />hystrix
									</label>
								</div>
								<div class="col-sm-2 control-label"><font color="red">*<i class="fa fa-etsy"></i></font>&nbsp;<font color="#0000CD">作者邮箱</font></div>
								<div class="col-sm-10">
									<input type="text" class="form-control" v-model="config.email" placeholder="作者邮箱" value="1335157415@qq.com"/>
								</div>

							</div>
						</div>


					</div>

				</form>
			</div>
		</div>


	</div>

</div>
<div id="generatorRender" style="display:none"></div>

<!-- 脚本执行失败提示框 -->
<section id="pwdFormModalWrapper">
	<div class="modal fade bs-example-modal-lg" id="pwdFormModal" tabindex="-1" role="dialog">
		<div class="modal-dialog modal-dialog-centered" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h5 class="modal-title">脚本错误提示</h5>
					<button type="button" class="close" data-dismiss="modal">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">
					<div id="pwdFormContent">
					</div>
				</div>
				<div class="modal-footer" align="center">
					<button type="button" class="btn btn-secondary" data-dismiss="modal" >取消</button>
					<button type="button" class="btn btn-primary" id="errorModalTip">确定</button>
				</div>
			</div>
		</div>
	</div>
</section>
<script src="js/generator.js"></script>
</body>
</html>